package com.qf.service.impl;

import com.qf.exception.CustomerException;
import com.qf.mapper.AdminMapper;
import com.qf.pojo.Admin;
import com.qf.service.AdminService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author zdl
 * @date 2025/2/10
 */
@Service
public class AdminServiceImpl implements AdminService {
    @Resource
    private AdminMapper adminMapper;
    @Override
    public Admin loginAdminByUsernameAndPassword(String username, String password) {
        Admin admin = adminMapper.selectAdminByUsernameAndPassword(username, password);
        if (admin != null){
            return admin;
        }else {
            throw  new CustomerException("5001","账号或密码错误");
        }
    }
}
